public class VarParameterExercise {
    public static void main(String[] args) {
        HspMethod m1 = new HspMethod();
        System.out.println(m1.showScore("AMao", 100, 50));
        System.out.println(m1.showScore("Tony", 100, 50, 44.4, 55.5, 66.6));
    }
}

class HspMethod {
    public String showScore(String name, double... scores) {
        double totalScore = 0;
        for (int i = 0; i < scores.length; i++) {
            totalScore += scores[i];
        }
        return name + "有" + scores.length + "门课的成绩总分=" + totalScore;
    }
}
